class Background {
  constructor(ctx) {
    this.img = new Image();
    //注意图片路径
    this.img.src = "images/bg.jpg";
    this.ctx = ctx;
  }

  draw() {
    this.ctx.drawImage(this.img, 0, -this.ctx.canvas.height, this.ctx.canvas.width, this.ctx.canvas.height);
    //绘制当前显示的背景图
    this.ctx.drawImage(this.img, 0, 0, this.ctx.canvas.width, this.ctx.canvas.height);

  }
}
export default Background;